libimobiledevice-1.3.0^20240916gited9703d-5.fc43

List of Findings

Error: CPPCHECK_WARNING (CWE-758): [#def1]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/ed25519/sha512.c:108: error[shiftTooManyBits]: Shifting 64-bit value by 64 bits is undefined behaviour
#  106|       /* fill W[16..79] */
#  107|       for (i = 16; i < 80; i++) {
#  108|->         W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
#  109|       }        
#  110|   

Error: GCC_ANALYZER_WARNING (CWE-127): [#def2]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_conv.c:142:12: warning[-Wanalyzer-out-of-bounds]: heap-based buffer under-read
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_conv.c:125:5: branch_false: following 'false' branch (when 'a' is non-NULL)...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_conv.c:142:12: danger: out-of-bounds read at byte -1 but region starts at byte 0
#  140|     j = size;
#  141|     while(1) {
#  142|->     a[j] = a[i];
#  143|       if(--i < 0)
#  144|         break;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:147:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'creat(&dotpath, 384)'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:192:1: enter_function: entry to 't_initrand'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:233:5: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:240:5: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:257:3: call_function: calling 't_fshash' from 't_initrand'
#  145|   
#  146|     sprintf(dotpath, "/tmp/rnd.%d", getpid());
#  147|->   if(creat(dotpath, 0600) >= 0 && stat(dotpath, &st) >= 0)
#  148|       SHA1Update(&ctxt, (unsigned char *) &st, sizeof(st));
#  149|     unlink(dotpath);

Error: COMPILER_WARNING (CWE-563): [#def4]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c: scope_hint: In function 't_initrand'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:194:12: warning[-Wunused-variable]: unused variable 'ctxt'
#  194 |   SHA1_CTX ctxt;
#      |            ^~~~
#  192|   t_initrand()
#  193|   {
#  194|->   SHA1_CTX ctxt;
#  195|   #ifdef USE_FTIME
#  196|     struct timeb t;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:233:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/dev/urandom", 0)'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:232:7: acquire_resource: opened here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:233:5: danger: 'open("/dev/urandom", 0)' leaks here; was opened at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  231|   #if !defined(WINDOWS) && !defined(WIN32)
#  232|     i = open("/dev/urandom", O_RDONLY);
#  233|->   if(i > 0) {
#  234|       r += read(i, preseed.devrand, sizeof(preseed.devrand));
#  235|       close(i);

Error: GCC_ANALYZER_WARNING: [#def6]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:234:10: warning[-Wanalyzer-fd-use-without-check]: 'read' on possibly invalid file descriptor 'open("/dev/urandom", 0)'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:232:7: acquire_resource: opened here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:233:5: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:234:10: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:234:10: danger: 'open("/dev/urandom", 0)' could be invalid: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  232|     i = open("/dev/urandom", O_RDONLY);
#  233|     if(i > 0) {
#  234|->     r += read(i, preseed.devrand, sizeof(preseed.devrand));
#  235|       close(i);
#  236|     }

Error: CPPCHECK_WARNING (CWE-476): [#def7]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:77: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   75|   
#   76|   	afc_client_t client_loc = (afc_client_t) malloc(sizeof(struct afc_client_private));
#   77|-> 	client_loc->parent = service_client;
#   78|   	client_loc->free_parent = 0;
#   79|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:77:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:97:13: enter_function: entry to 'afc_client_new'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:103:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:107:27: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:107:27: call_function: calling 'afc_client_new_with_service_client' from 'afc_client_new'
#   75|   
#   76|   	afc_client_t client_loc = (afc_client_t) malloc(sizeof(struct afc_client_private));
#   77|-> 	client_loc->parent = service_client;
#   78|   	client_loc->free_parent = 0;
#   79|   

Error: CPPCHECK_WARNING (CWE-476): [#def9]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:78: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   76|   	afc_client_t client_loc = (afc_client_t) malloc(sizeof(struct afc_client_private));
#   77|   	client_loc->parent = service_client;
#   78|-> 	client_loc->free_parent = 0;
#   79|   
#   80|   	/* allocate a packet */

Error: CPPCHECK_WARNING (CWE-476): [#def10]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:81: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   79|   
#   80|   	/* allocate a packet */
#   81|-> 	client_loc->packet_extra = 1024;
#   82|   	client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket) + client_loc->packet_extra);
#   83|   	if (!client_loc->afc_packet) {

Error: CPPCHECK_WARNING (CWE-476): [#def11]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:82: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   80|   	/* allocate a packet */
#   81|   	client_loc->packet_extra = 1024;
#   82|-> 	client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket) + client_loc->packet_extra);
#   83|   	if (!client_loc->afc_packet) {
#   84|   		free(client_loc);

Error: CPPCHECK_WARNING (CWE-476): [#def12]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:83: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   81|   	client_loc->packet_extra = 1024;
#   82|   	client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket) + client_loc->packet_extra);
#   83|-> 	if (!client_loc->afc_packet) {
#   84|   		free(client_loc);
#   85|   		return AFC_E_NO_MEM;

Error: CPPCHECK_WARNING (CWE-476): [#def13]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:394: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: list
#  392|   	list = (char **) malloc(sizeof(char *) * (nulls + 1));
#  393|   	for (i = 0; i < nulls; i++) {
#  394|-> 		list[i] = strdup(tokens + j);
#  395|   		j += strlen(list[i]) + 1;
#  396|   	}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:394:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'list'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:392:26: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:393:21: branch_true: following 'true' branch (when 'nulls > i')...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:394:27: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:394:17: danger: 'list + (long unsigned int)i * 8' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  392|   	list = (char **) malloc(sizeof(char *) * (nulls + 1));
#  393|   	for (i = 0; i < nulls; i++) {
#  394|-> 		list[i] = strdup(tokens + j);
#  395|   		j += strlen(list[i]) + 1;
#  396|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def15]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:395: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: list
#  393|   	for (i = 0; i < nulls; i++) {
#  394|   		list[i] = strdup(tokens + j);
#  395|-> 		j += strlen(list[i]) + 1;
#  396|   	}
#  397|   	list[i] = NULL;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def16]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:395:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'strdup(tokens + (sizetype)j)' where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:393:21: branch_true: following 'true' branch (when 'nulls > i')...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:394:27: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:394:27: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:395:22: danger: argument 1 ('strdup(tokens + (sizetype)j)') from [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#argument 1 of '__builtin_strlen' must be non-null
#  393|   	for (i = 0; i < nulls; i++) {
#  394|   		list[i] = strdup(tokens + j);
#  395|-> 		j += strlen(list[i]) + 1;
#  396|   	}
#  397|   	list[i] = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def17]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:397: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: list
#  395|   		j += strlen(list[i]) + 1;
#  396|   	}
#  397|-> 	list[i] = NULL;
#  398|   
#  399|   	return list;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def18]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:397:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'list'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:392:26: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:393:21: branch_false: following 'false' branch (when 'nulls <= i')...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:397:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:397:9: danger: 'list + (long unsigned int)i * 8' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  395|   		j += strlen(list[i]) + 1;
#  396|   	}
#  397|-> 	list[i] = NULL;
#  398|   
#  399|   	return list;

Error: CPPCHECK_WARNING (CWE-476): [#def19]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:89: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   87|   
#   88|   	bt_packet_logger_client_t client_loc = (bt_packet_logger_client_t) malloc(sizeof(struct bt_packet_logger_client_private));
#   89|-> 	client_loc->parent = parent;
#   90|   	client_loc->worker = THREAD_T_NULL;
#   91|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:89:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:74:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:83:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:83:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:88:76: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:88:76: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:89:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   87|   
#   88|   	bt_packet_logger_client_t client_loc = (bt_packet_logger_client_t) malloc(sizeof(struct bt_packet_logger_client_private));
#   89|-> 	client_loc->parent = parent;
#   90|   	client_loc->worker = THREAD_T_NULL;
#   91|   

Error: CPPCHECK_WARNING (CWE-476): [#def21]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:90: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   88|   	bt_packet_logger_client_t client_loc = (bt_packet_logger_client_t) malloc(sizeof(struct bt_packet_logger_client_private));
#   89|   	client_loc->parent = parent;
#   90|-> 	client_loc->worker = THREAD_T_NULL;
#   91|   
#   92|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def22]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:84: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   82|   
#   83|   	companion_proxy_client_t client_loc = (companion_proxy_client_t) malloc(sizeof(struct companion_proxy_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   	client_loc->event_thread = THREAD_T_NULL;
#   86|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def23]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:84:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:69:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:78:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:78:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:83:74: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:83:74: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:84:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   82|   
#   83|   	companion_proxy_client_t client_loc = (companion_proxy_client_t) malloc(sizeof(struct companion_proxy_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   	client_loc->event_thread = THREAD_T_NULL;
#   86|   

Error: CPPCHECK_WARNING (CWE-476): [#def24]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:85: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   83|   	companion_proxy_client_t client_loc = (companion_proxy_client_t) malloc(sizeof(struct companion_proxy_client_private));
#   84|   	client_loc->parent = plclient;
#   85|-> 	client_loc->event_thread = THREAD_T_NULL;
#   86|   
#   87|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def25]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:90: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   88|   
#   89|   	debugserver_client_t client_loc = (debugserver_client_t) malloc(sizeof(struct debugserver_client_private));
#   90|-> 	client_loc->parent = parent;
#   91|   	client_loc->noack_mode = 0;
#   92|   	client_loc->cancel_receive = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def26]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:91: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   89|   	debugserver_client_t client_loc = (debugserver_client_t) malloc(sizeof(struct debugserver_client_private));
#   90|   	client_loc->parent = parent;
#   91|-> 	client_loc->noack_mode = 0;
#   92|   	client_loc->cancel_receive = NULL;
#   93|   	client_loc->receive_loop_timeout = 1000;

Error: CPPCHECK_WARNING (CWE-476): [#def27]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:92: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   90|   	client_loc->parent = parent;
#   91|   	client_loc->noack_mode = 0;
#   92|-> 	client_loc->cancel_receive = NULL;
#   93|   	client_loc->receive_loop_timeout = 1000;
#   94|   

Error: CPPCHECK_WARNING (CWE-476): [#def28]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:93: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   91|   	client_loc->noack_mode = 0;
#   92|   	client_loc->cancel_receive = NULL;
#   93|-> 	client_loc->receive_loop_timeout = 1000;
#   94|   
#   95|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def29]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:181: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: tmp
#  179|   
#  180|   	/* copy name */
#  181|-> 	tmp->name = strdup(name);
#  182|   
#  183|   	/* copy arguments */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def30]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:181:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'tmp'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:562:21: enter_function: entry to 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:564:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:568:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: call_function: calling 'debugserver_command_new' from 'debugserver_client_set_environment_hex_encoded'
#  179|   
#  180|   	/* copy name */
#  181|-> 	tmp->name = strdup(name);
#  182|   
#  183|   	/* copy arguments */

Error: CPPCHECK_WARNING (CWE-476): [#def31]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:184: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: tmp
#  182|   
#  183|   	/* copy arguments */
#  184|-> 	tmp->argc = argc;
#  185|   	tmp->argv = NULL;
#  186|   	if (argc > 0) {

Error: CPPCHECK_WARNING (CWE-476): [#def32]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:185: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: tmp
#  183|   	/* copy arguments */
#  184|   	tmp->argc = argc;
#  185|-> 	tmp->argv = NULL;
#  186|   	if (argc > 0) {
#  187|   		tmp->argv = malloc(sizeof(char*) * (argc + 2));

Error: GCC_ANALYZER_WARNING (CWE-476): [#def33]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:189:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)(argc + 2) * 8)'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:562:21: enter_function: entry to 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:564:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:568:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: call_function: calling 'debugserver_command_new' from 'debugserver_client_set_environment_hex_encoded'
#  187|   		tmp->argv = malloc(sizeof(char*) * (argc + 2));
#  188|   		for (i = 0; i < argc; i++) {
#  189|-> 			tmp->argv[i] = strdup(argv[i]);
#  190|   		}
#  191|   		tmp->argv[i+1] = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def34]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:289:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:562:21: enter_function: entry to 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:564:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:568:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: call_function: calling 'debugserver_command_new' from 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: return_function: returning to 'debugserver_client_set_environment_hex_encoded' from 'debugserver_command_new'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:573:18: call_function: calling 'debugserver_client_send_command' from 'debugserver_client_set_environment_hex_encoded'
#  287|   	for (position = 0, index = 0; index < length; index++) {
#  288|   		position = (index * (2 * sizeof(char)));
#  289|-> 		(*encoded_buffer)[position] = DEBUGSERVER_HEX_ENCODE_FIRST_BYTE(buffer[index]);
#  290|   		(*encoded_buffer)[position + 1] = DEBUGSERVER_HEX_ENCODE_SECOND_BYTE(buffer[index]);
#  291|   	}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def35]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:419:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'buffer'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:562:21: enter_function: entry to 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:564:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:568:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: call_function: calling 'debugserver_command_new' from 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: return_function: returning to 'debugserver_client_set_environment_hex_encoded' from 'debugserver_command_new'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:573:18: call_function: calling 'debugserver_client_send_command' from 'debugserver_client_set_environment_hex_encoded'
#  417|   		} else if (data == '$') {
#  418|   			debug_info("received prefix ($)");
#  419|-> 			buffer[0] = '$';
#  420|   			buffer_size = 1;
#  421|   			skip_prefix = 1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def36]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:438:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'buffer'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:562:21: enter_function: entry to 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:564:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:568:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: call_function: calling 'debugserver_command_new' from 'debugserver_client_set_environment_hex_encoded'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:572:9: return_function: returning to 'debugserver_client_set_environment_hex_encoded' from 'debugserver_command_new'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:573:18: call_function: calling 'debugserver_client_send_command' from 'debugserver_client_set_environment_hex_encoded'
#  436|   		if (data == '$') {
#  437|   			debug_info("received prefix ($)");
#  438|-> 			buffer[0] = '$';
#  439|   			buffer_size = 1;
#  440|   		} else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def37]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:584:24: warning[-Wanalyzer-malloc-leak]: leak of 'pkt'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:581:21: enter_function: entry to 'debugserver_client_set_argv'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:583:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:605:24: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:611:16: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:620:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:628:24: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: call_function: inlined call to 'debugserver_int2hex' from 'debugserver_client_set_argv'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:628:24: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: call_function: inlined call to 'debugserver_int2hex' from 'debugserver_client_set_argv'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:628:24: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: call_function: inlined call to 'debugserver_int2hex' from 'debugserver_client_set_argv'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:611:16: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:584:24: danger: 'pkt' leaks here; was allocated at [(4)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/3)
#  582|   {
#  583|   	if (!client || !argc)
#  584|-> 		return DEBUGSERVER_E_INVALID_ARG;
#  585|   
#  586|   	debugserver_error_t result = DEBUGSERVER_E_UNKNOWN_ERROR;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def38]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:584:24: warning[-Wanalyzer-malloc-leak]: leak of 'pktp'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:583:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:605:24: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:611:16: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:584:24: danger: 'pktp' leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  582|   {
#  583|   	if (!client || !argc)
#  584|-> 		return DEBUGSERVER_E_INVALID_ARG;
#  585|   
#  586|   	debugserver_error_t result = DEBUGSERVER_E_UNKNOWN_ERROR;

Error: CPPCHECK_WARNING (CWE-476): [#def39]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:606: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pkt
#  604|   	/* allocate packet and initialize it */
#  605|   	pkt = (char *) malloc(pkt_len + 1);
#  606|-> 	memset(pkt, 0, pkt_len + 1);
#  607|   
#  608|   	char *pktp = pkt;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def40]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'p'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:581:21: enter_function: entry to 'debugserver_client_set_argv'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:583:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:611:16: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:620:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:625:30: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:628:24: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: call_function: inlined call to 'debugserver_int2hex' from 'debugserver_client_set_argv'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:25: danger: 'p' could be NULL: unchecked value from [(8)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/7)
#  627|   		char *q = (char*)argv[i];
#  628|   		while (*q) {
#  629|-> 			*p++ = DEBUGSERVER_HEX_ENCODE_FIRST_BYTE(*q);
#  630|   			*p++ = DEBUGSERVER_HEX_ENCODE_SECOND_BYTE(*q);
#  631|   			q++;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def41]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:637:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'm'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:583:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:611:16: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:620:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:628:24: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:634:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:637:17: danger: use of uninitialized value 'm' here
#  635|   		pktp += strlen(prefix);
#  636|   
#  637|-> 		memcpy(pktp, m, arg_hexlen);
#  638|   		pktp += arg_hexlen;
#  639|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def42]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:646:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pkt'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:583:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:605:24: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:646:9: danger: 'pkt' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/2)
#  644|   	}
#  645|   
#  646|-> 	pkt[0] = 'A';
#  647|   
#  648|   	debugserver_command_t command = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def43]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:124: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  122|   	/* create client object */
#  123|   	device_link_service_client_t client_loc = (device_link_service_client_t) malloc(sizeof(struct device_link_service_client_private));
#  124|-> 	client_loc->parent = plistclient;
#  125|   
#  126|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:124:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:112:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:118:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:118:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:123:82: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:123:82: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:124:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  122|   	/* create client object */
#  123|   	device_link_service_client_t client_loc = (device_link_service_client_t) malloc(sizeof(struct device_link_service_client_private));
#  124|-> 	client_loc->parent = plistclient;
#  125|   
#  126|   	/* all done, return success */

Error: CPPCHECK_WARNING (CWE-476): [#def45]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:89: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   87|   	/* create client object */
#   88|   	diagnostics_relay_client_t client_loc = (diagnostics_relay_client_t) malloc(sizeof(struct diagnostics_relay_client_private));
#   89|-> 	client_loc->parent = plistclient;
#   90|   
#   91|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def46]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:89:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:78:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:83:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:88:78: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:88:78: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:89:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   87|   	/* create client object */
#   88|   	diagnostics_relay_client_t client_loc = (diagnostics_relay_client_t) malloc(sizeof(struct diagnostics_relay_client_private));
#   89|-> 	client_loc->parent = plistclient;
#   90|   
#   91|   	/* all done, return success */

Error: CPPCHECK_WARNING (CWE-476): [#def47]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:44: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   42|   	/* create client object */
#   43|   	file_relay_client_t client_loc = (file_relay_client_t) malloc(sizeof(struct file_relay_client_private));
#   44|-> 	client_loc->parent = plistclient;
#   45|   
#   46|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def48]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:44:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:33:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:38:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:43:64: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:43:64: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:44:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   42|   	/* create client object */
#   43|   	file_relay_client_t client_loc = (file_relay_client_t) malloc(sizeof(struct file_relay_client_private));
#   44|-> 	client_loc->parent = plistclient;
#   45|   
#   46|   	/* all done, return success */

Error: CPPCHECK_WARNING (CWE-476): [#def49]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:84: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   82|   
#   83|   	heartbeat_client_t client_loc = (heartbeat_client_t) malloc(sizeof(struct heartbeat_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   
#   86|   	*client = client_loc;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def50]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:84:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:69:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:78:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:78:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:83:62: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:83:62: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:84:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   82|   
#   83|   	heartbeat_client_t client_loc = (heartbeat_client_t) malloc(sizeof(struct heartbeat_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   
#   86|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def51]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:70: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   68|   
#   69|   	house_arrest_client_t client_loc = (house_arrest_client_t) malloc(sizeof(struct house_arrest_client_private));
#   70|-> 	client_loc->parent = plistclient;
#   71|   	client_loc->mode = HOUSE_ARREST_CLIENT_MODE_NORMAL;
#   72|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def52]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:70:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:65:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:65:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:69:68: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:69:68: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:70:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   68|   
#   69|   	house_arrest_client_t client_loc = (house_arrest_client_t) malloc(sizeof(struct house_arrest_client_private));
#   70|-> 	client_loc->parent = plistclient;
#   71|   	client_loc->mode = HOUSE_ARREST_CLIENT_MODE_NORMAL;
#   72|   

Error: CPPCHECK_WARNING (CWE-476): [#def53]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:71: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   69|   	house_arrest_client_t client_loc = (house_arrest_client_t) malloc(sizeof(struct house_arrest_client_private));
#   70|   	client_loc->parent = plistclient;
#   71|-> 	client_loc->mode = HOUSE_ARREST_CLIENT_MODE_NORMAL;
#   72|   
#   73|   	*client = client_loc;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def54]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:332:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'newlist'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:319:9: release_memory: '*devices' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:322:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:330:21: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:331:70: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:332:24: release_memory: 'newlist' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:332:17: danger: dereference of NULL 'newlist + (long unsigned int)newcount * 8'
#  330|   	for (i = 0; dev_list[i].handle > 0; i++) {
#  331|   		newlist = realloc(*devices, sizeof(idevice_info_t) * (newcount+1));
#  332|-> 		newlist[newcount] = malloc(sizeof(struct idevice_info));
#  333|   		newlist[newcount]->udid = strdup(dev_list[i].udid);
#  334|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def55]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:333:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc(24)'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:322:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:330:21: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:331:70: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:332:37: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:333:17: danger: 'malloc(24)' could be NULL: unchecked value from [(6)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/5)
#  331|   		newlist = realloc(*devices, sizeof(idevice_info_t) * (newcount+1));
#  332|   		newlist[newcount] = malloc(sizeof(struct idevice_info));
#  333|-> 		newlist[newcount]->udid = strdup(dev_list[i].udid);
#  334|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {
#  335|   			newlist[newcount]->conn_type = CONNECTION_USBMUXD;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def56]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:25: warning[-Wanalyzer-null-dereference]: dereference of NULL 'newlist'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:389:9: release_memory: '*devices' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:392:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:400:21: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:401:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:401:20: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:402:69: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:32: release_memory: 'newlist' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:404:25: release_memory: 'newlist' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:404:25: release_memory: 'newlist' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:404:25: release_memory: 'newlist' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:25: danger: dereference of NULL 'newlist + (long unsigned int)newcount * 8'
#  401|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {
#  402|   			newlist = realloc(*devices, sizeof(char*) * (newcount+1));
#  403|-> 			newlist[newcount++] = strdup(dev_list[i].udid);
#  404|   			*devices = newlist;
#  405|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def57]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:62: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:392:12: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:400:21: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:401:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:400:21: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:401:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:401:20: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:402:69: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:47: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:400:21: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:401:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:62: danger: '<unknown>' leaks here; was allocated at [(10)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/9)
#  401|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {
#  402|   			newlist = realloc(*devices, sizeof(char*) * (newcount+1));
#  403|-> 			newlist[newcount++] = strdup(dev_list[i].udid);
#  404|   			*devices = newlist;
#  405|   		}

Error: CPPCHECK_WARNING (CWE-476): [#def58]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:550: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  548|   		}
#  549|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  550|-> 		new_connection->type = CONNECTION_USBMUXD;
#  551|   		new_connection->data = (void*)(long)sfd;
#  552|   		new_connection->ssl_data = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def59]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:550:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_connection'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:531:12: branch_false: following 'false' branch (when 'device' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:535:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:535:12: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:536:27: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:537:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:549:77: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:549:77: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:550:17: danger: 'new_connection' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/6)
#  548|   		}
#  549|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  550|-> 		new_connection->type = CONNECTION_USBMUXD;
#  551|   		new_connection->data = (void*)(long)sfd;
#  552|   		new_connection->ssl_data = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def60]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:551: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  549|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  550|   		new_connection->type = CONNECTION_USBMUXD;
#  551|-> 		new_connection->data = (void*)(long)sfd;
#  552|   		new_connection->ssl_data = NULL;
#  553|   		new_connection->device = device;

Error: CPPCHECK_WARNING (CWE-476): [#def61]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:552: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  550|   		new_connection->type = CONNECTION_USBMUXD;
#  551|   		new_connection->data = (void*)(long)sfd;
#  552|-> 		new_connection->ssl_data = NULL;
#  553|   		new_connection->device = device;
#  554|   		new_connection->ssl_recv_timeout = (unsigned int)-1;

Error: CPPCHECK_WARNING (CWE-476): [#def62]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:553: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  551|   		new_connection->data = (void*)(long)sfd;
#  552|   		new_connection->ssl_data = NULL;
#  553|-> 		new_connection->device = device;
#  554|   		new_connection->ssl_recv_timeout = (unsigned int)-1;
#  555|   		new_connection->status = IDEVICE_E_SUCCESS;

Error: CPPCHECK_WARNING (CWE-476): [#def63]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:554: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  552|   		new_connection->ssl_data = NULL;
#  553|   		new_connection->device = device;
#  554|-> 		new_connection->ssl_recv_timeout = (unsigned int)-1;
#  555|   		new_connection->status = IDEVICE_E_SUCCESS;
#  556|   		*connection = new_connection;

Error: CPPCHECK_WARNING (CWE-476): [#def64]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:555: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  553|   		new_connection->device = device;
#  554|   		new_connection->ssl_recv_timeout = (unsigned int)-1;
#  555|-> 		new_connection->status = IDEVICE_E_SUCCESS;
#  556|   		*connection = new_connection;
#  557|   		return IDEVICE_E_SUCCESS;

Error: CPPCHECK_WARNING (CWE-476): [#def65]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:595: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  593|   
#  594|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  595|-> 		new_connection->type = CONNECTION_NETWORK;
#  596|   		new_connection->data = (void*)(long)sfd;
#  597|   		new_connection->ssl_data = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def66]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:595:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_connection'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:531:12: branch_false: following 'false' branch (when 'device' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:535:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:535:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:559:12: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:559:12: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:560:34: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:582:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:594:77: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:594:77: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:595:17: danger: 'new_connection' could be NULL: unchecked value from [(11)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/10)
#  593|   
#  594|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  595|-> 		new_connection->type = CONNECTION_NETWORK;
#  596|   		new_connection->data = (void*)(long)sfd;
#  597|   		new_connection->ssl_data = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def67]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:596: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  594|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  595|   		new_connection->type = CONNECTION_NETWORK;
#  596|-> 		new_connection->data = (void*)(long)sfd;
#  597|   		new_connection->ssl_data = NULL;
#  598|   		new_connection->device = device;

Error: CPPCHECK_WARNING (CWE-476): [#def68]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:597: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  595|   		new_connection->type = CONNECTION_NETWORK;
#  596|   		new_connection->data = (void*)(long)sfd;
#  597|-> 		new_connection->ssl_data = NULL;
#  598|   		new_connection->device = device;
#  599|   		new_connection->ssl_recv_timeout = (unsigned int)-1;

Error: CPPCHECK_WARNING (CWE-476): [#def69]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:598: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  596|   		new_connection->data = (void*)(long)sfd;
#  597|   		new_connection->ssl_data = NULL;
#  598|-> 		new_connection->device = device;
#  599|   		new_connection->ssl_recv_timeout = (unsigned int)-1;
#  600|   

Error: CPPCHECK_WARNING (CWE-476): [#def70]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:599: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_connection
#  597|   		new_connection->ssl_data = NULL;
#  598|   		new_connection->device = device;
#  599|-> 		new_connection->ssl_recv_timeout = (unsigned int)-1;
#  600|   
#  601|   		*connection = new_connection;

Error: CPPCHECK_WARNING (CWE-476): [#def71]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1354: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ssl_data_loc
# 1352|   	} else {
# 1353|   		ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private));
# 1354|-> 		ssl_data_loc->session = ssl;
# 1355|   		ssl_data_loc->ctx = ssl_ctx;
# 1356|   		connection->ssl_data = ssl_data_loc;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def72]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1354:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'ssl_data_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1199:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1206:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1212:20: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1222:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1227:28: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1228:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1236:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1324:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1330:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1348:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1353:55: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1353:55: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1354:17: danger: 'ssl_data_loc' could be NULL: unchecked value from [(13)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/12)
# 1352|   	} else {
# 1353|   		ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private));
# 1354|-> 		ssl_data_loc->session = ssl;
# 1355|   		ssl_data_loc->ctx = ssl_ctx;
# 1356|   		connection->ssl_data = ssl_data_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def73]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1355: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ssl_data_loc
# 1353|   		ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private));
# 1354|   		ssl_data_loc->session = ssl;
# 1355|-> 		ssl_data_loc->ctx = ssl_ctx;
# 1356|   		connection->ssl_data = ssl_data_loc;
# 1357|   		ret = IDEVICE_E_SUCCESS;

Error: CPPCHECK_WARNING (CWE-476): [#def74]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:244: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  242|   
#  243|   	instproxy_client_t client_loc = (instproxy_client_t) malloc(sizeof(struct instproxy_client_private));
#  244|-> 	client_loc->parent = plistclient;
#  245|   	mutex_init(&client_loc->mutex);
#  246|   	client_loc->receive_status_thread = THREAD_T_NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def75]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:246: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  244|   	client_loc->parent = plistclient;
#  245|   	mutex_init(&client_loc->mutex);
#  246|-> 	client_loc->receive_status_thread = THREAD_T_NULL;
#  247|   
#  248|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def76]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:934: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: key
#  932|   	while (arg) {
#  933|   		char *key = strdup(arg);
#  934|-> 		if (!strcmp(key, "SkipUninstall")) {
#  935|   			int intval = va_arg(args, int);
#  936|   			plist_dict_set_item(client_options, key, plist_new_bool(intval));

Error: GCC_ANALYZER_WARNING (CWE-688): [#def77]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:934:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'key' where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:926:12: branch_false: following 'false' branch (when 'client_options' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:930:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:932:16: branch_true: following 'true' branch (when 'arg' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:933:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:933:29: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:934:22: danger: argument 1 ('key') from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#  932|   	while (arg) {
#  933|   		char *key = strdup(arg);
#  934|-> 		if (!strcmp(key, "SkipUninstall")) {
#  935|   			int intval = va_arg(args, int);
#  936|   			plist_dict_set_item(client_options, key, plist_new_bool(intval));

Error: GCC_ANALYZER_WARNING (CWE-686): [#def78]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:935:29: warning[-Wanalyzer-va-arg-type-mismatch]: 'va_arg' expected 'int' but received 'char (*)[4]' for variadic argument 2 of 'args'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:986:19: enter_function: entry to 'instproxy_client_get_path_for_bundle_identifier'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:988:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:995:9: call_function: calling 'instproxy_client_options_add' from 'instproxy_client_get_path_for_bundle_identifier' with 3 variadic arguments
#  933|   		char *key = strdup(arg);
#  934|   		if (!strcmp(key, "SkipUninstall")) {
#  935|-> 			int intval = va_arg(args, int);
#  936|   			plist_dict_set_item(client_options, key, plist_new_bool(intval));
#  937|   		} else if (!strcmp(key, "ApplicationSINF") || !strcmp(key, "iTunesMetadata") || !strcmp(key, "ReturnAttributes") || !strcmp(key, "BundleIDs")) {

Error: CPPCHECK_WARNING (CWE-476): [#def79]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:1045: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 1043|   
# 1044|   	char* ret = (char*)malloc(strlen(path_str) + 1 + strlen(exec_str) + 1);
# 1045|-> 	strcpy(ret, path_str);
# 1046|   	strcat(ret, "/");
# 1047|   	strcat(ret, exec_str);

Error: CPPCHECK_WARNING (CWE-476): [#def80]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:1046: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 1044|   	char* ret = (char*)malloc(strlen(path_str) + 1 + strlen(exec_str) + 1);
# 1045|   	strcpy(ret, path_str);
# 1046|-> 	strcat(ret, "/");
# 1047|   	strcat(ret, exec_str);
# 1048|   

Error: CPPCHECK_WARNING (CWE-476): [#def81]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:1047: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 1045|   	strcpy(ret, path_str);
# 1046|   	strcat(ret, "/");
# 1047|-> 	strcat(ret, exec_str);
# 1048|   
# 1049|   	*path = ret;

Error: COMPILER_WARNING: [#def82]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c: scope_hint: In function 'lockdownd_cu_send_request_and_get_reply'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c:962:38: warning[-Wunterminated-string-initialization]: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (13 chars into 12 available)
#  962 |         unsigned char cu_nonce[12] = "sendone01234"; // guaranteed to be random by fair dice troll
#      |                                      ^~~~~~~~~~~~~~
#  960|   
#  961|   	// Starting with iOS/tvOS 11.2 and WatchOS 4.2, this nonce is random and sent along with the request. Before, the request doesn't have a nonce and it uses hardcoded nonce "sendone01234".
#  962|-> 	unsigned char cu_nonce[12] = "sendone01234"; // guaranteed to be random by fair dice troll
#  963|           if (client->device->version >= DEVICE_VERSION(11,2,0)) {
#  964|   #if defined(HAVE_OPENSSL)

Error: CPPCHECK_WARNING (CWE-476): [#def83]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:630: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  628|   
#  629|   	lockdownd_client_t client_loc = (lockdownd_client_t) malloc(sizeof(struct lockdownd_client_private));
#  630|-> 	client_loc->parent = plistclient;
#  631|   	client_loc->ssl_enabled = 0;
#  632|   	client_loc->session_id = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def84]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:631: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  629|   	lockdownd_client_t client_loc = (lockdownd_client_t) malloc(sizeof(struct lockdownd_client_private));
#  630|   	client_loc->parent = plistclient;
#  631|-> 	client_loc->ssl_enabled = 0;
#  632|   	client_loc->session_id = NULL;
#  633|   	client_loc->device = device;

Error: CPPCHECK_WARNING (CWE-476): [#def85]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:632: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  630|   	client_loc->parent = plistclient;
#  631|   	client_loc->ssl_enabled = 0;
#  632|-> 	client_loc->session_id = NULL;
#  633|   	client_loc->device = device;
#  634|   	client_loc->cu_key = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def86]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:633: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  631|   	client_loc->ssl_enabled = 0;
#  632|   	client_loc->session_id = NULL;
#  633|-> 	client_loc->device = device;
#  634|   	client_loc->cu_key = NULL;
#  635|   	client_loc->cu_key_len = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def87]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:634: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  632|   	client_loc->session_id = NULL;
#  633|   	client_loc->device = device;
#  634|-> 	client_loc->cu_key = NULL;
#  635|   	client_loc->cu_key_len = 0;
#  636|   

Error: CPPCHECK_WARNING (CWE-476): [#def88]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:635: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  633|   	client_loc->device = device;
#  634|   	client_loc->cu_key = NULL;
#  635|-> 	client_loc->cu_key_len = 0;
#  636|   
#  637|   	if (device->udid) {

Error: CPPCHECK_WARNING (CWE-476): [#def89]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:641: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  639|   	}
#  640|   
#  641|-> 	client_loc->label = label ? strdup(label) : NULL;
#  642|   
#  643|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def90]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown.c:1355: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: *service
# 1353|   		if (*service == NULL)
# 1354|   			*service = (lockdownd_service_descriptor_t)malloc(sizeof(struct lockdownd_service_descriptor));
# 1355|-> 		(*service)->port = 0;
# 1356|   		(*service)->ssl_enabled = 0;
# 1357|   		(*service)->identifier = strdup(identifier);

Error: CPPCHECK_WARNING (CWE-476): [#def91]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:101: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   99|   
#  100|   	misagent_client_t client_loc = (misagent_client_t) malloc(sizeof(struct misagent_client_private));
#  101|-> 	client_loc->parent = plistclient;
#  102|   	client_loc->last_error = 0;
#  103|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def92]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:101:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:96:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:96:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:100:60: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:100:60: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:101:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   99|   
#  100|   	misagent_client_t client_loc = (misagent_client_t) malloc(sizeof(struct misagent_client_private));
#  101|-> 	client_loc->parent = plistclient;
#  102|   	client_loc->last_error = 0;
#  103|   

Error: CPPCHECK_WARNING (CWE-476): [#def93]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:102: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  100|   	misagent_client_t client_loc = (misagent_client_t) malloc(sizeof(struct misagent_client_private));
#  101|   	client_loc->parent = plistclient;
#  102|-> 	client_loc->last_error = 0;
#  103|   
#  104|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def94]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:90: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   88|   
#   89|   	mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private));
#   90|-> 	client_loc->parent = plistclient;
#   91|   
#   92|   	mutex_init(&client_loc->mutex);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def95]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:90:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:85:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:85:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:89:84: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:89:84: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:90:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   88|   
#   89|   	mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private));
#   90|-> 	client_loc->parent = plistclient;
#   91|   
#   92|   	mutex_init(&client_loc->mutex);

Error: CPPCHECK_WARNING (CWE-476): [#def96]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:70: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   68|   	/* create client object */
#   69|   	mobileactivation_client_t client_loc = (mobileactivation_client_t) malloc(sizeof(struct mobileactivation_client_private));
#   70|-> 	client_loc->parent = plistclient;
#   71|   
#   72|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def97]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:70:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:59:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:64:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:69:76: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:69:76: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:70:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   68|   	/* create client object */
#   69|   	mobileactivation_client_t client_loc = (mobileactivation_client_t) malloc(sizeof(struct mobileactivation_client_private));
#   70|-> 	client_loc->parent = plistclient;
#   71|   
#   72|   	/* all done, return success */

Error: CPPCHECK_WARNING (CWE-476): [#def98]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:84: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   82|   
#   83|   	mobilebackup_client_t client_loc = (mobilebackup_client_t) malloc(sizeof(struct mobilebackup_client_private));
#   84|-> 	client_loc->parent = dlclient;
#   85|   
#   86|   	/* perform handshake */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def99]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:84:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:74:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:79:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:79:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:83:68: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:83:68: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:84:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   82|   
#   83|   	mobilebackup_client_t client_loc = (mobilebackup_client_t) malloc(sizeof(struct mobilebackup_client_private));
#   84|-> 	client_loc->parent = dlclient;
#   85|   
#   86|   	/* perform handshake */

Error: CPPCHECK_WARNING (CWE-476): [#def100]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:84: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   82|   
#   83|   	mobilebackup2_client_t client_loc = (mobilebackup2_client_t) malloc(sizeof(struct mobilebackup2_client_private));
#   84|-> 	client_loc->parent = dlclient;
#   85|   
#   86|   	/* perform handshake */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def101]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:84:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:74:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:79:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:79:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:83:70: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:83:70: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:84:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   82|   
#   83|   	mobilebackup2_client_t client_loc = (mobilebackup2_client_t) malloc(sizeof(struct mobilebackup2_client_private));
#   84|-> 	client_loc->parent = dlclient;
#   85|   
#   86|   	/* perform handshake */

Error: CPPCHECK_WARNING (CWE-476): [#def102]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:87: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   85|   
#   86|   	mobilesync_client_t client_loc = (mobilesync_client_t) malloc(sizeof(struct mobilesync_client_private));
#   87|-> 	client_loc->parent = dlclient;
#   88|   	client_loc->direction = MOBILESYNC_SYNC_DIR_DEVICE_TO_COMPUTER;
#   89|   	client_loc->data_class = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def103]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:87:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:77:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:82:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:82:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:86:64: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:86:64: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:87:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   85|   
#   86|   	mobilesync_client_t client_loc = (mobilesync_client_t) malloc(sizeof(struct mobilesync_client_private));
#   87|-> 	client_loc->parent = dlclient;
#   88|   	client_loc->direction = MOBILESYNC_SYNC_DIR_DEVICE_TO_COMPUTER;
#   89|   	client_loc->data_class = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def104]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:88: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   86|   	mobilesync_client_t client_loc = (mobilesync_client_t) malloc(sizeof(struct mobilesync_client_private));
#   87|   	client_loc->parent = dlclient;
#   88|-> 	client_loc->direction = MOBILESYNC_SYNC_DIR_DEVICE_TO_COMPUTER;
#   89|   	client_loc->data_class = NULL;
#   90|   

Error: CPPCHECK_WARNING (CWE-476): [#def105]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:89: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   87|   	client_loc->parent = dlclient;
#   88|   	client_loc->direction = MOBILESYNC_SYNC_DIR_DEVICE_TO_COMPUTER;
#   89|-> 	client_loc->data_class = NULL;
#   90|   
#   91|   	/* perform handshake */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def106]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:721:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'anchors'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:719:63: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:720:12: branch_true: following 'true' branch (when 'device_anchor' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:721:42: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:721:17: danger: 'anchors' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  719|   	mobilesync_anchors_t anchors = (mobilesync_anchors_t) malloc(sizeof(mobilesync_anchors));
#  720|   	if (device_anchor != NULL) {
#  721|-> 		anchors->device_anchor = strdup(device_anchor);
#  722|   	} else {
#  723|   		anchors->device_anchor = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def107]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:723:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'anchors'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:719:63: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:720:12: branch_false: following 'false' branch (when 'device_anchor' is NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:723:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:723:17: danger: 'anchors' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  721|   		anchors->device_anchor = strdup(device_anchor);
#  722|   	} else {
#  723|-> 		anchors->device_anchor = NULL;
#  724|   	}
#  725|   	if (computer_anchor != NULL) {

Error: CPPCHECK_WARNING (CWE-476): [#def108]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:726: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: anchors
#  724|   	}
#  725|   	if (computer_anchor != NULL) {
#  726|-> 		anchors->computer_anchor = strdup(computer_anchor);
#  727|   	} else {
#  728|   		anchors->computer_anchor = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def109]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:728: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: anchors
#  726|   		anchors->computer_anchor = strdup(computer_anchor);
#  727|   	} else {
#  728|-> 		anchors->computer_anchor = NULL;
#  729|   	}
#  730|   

Error: CPPCHECK_WARNING (CWE-476): [#def110]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:762: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: key
#  760|   	while (arg) {
#  761|   		char *key = strdup(arg);
#  762|-> 		if (!strcmp(key, "SyncDeviceLinkEntityNamesKey")) {
#  763|   			char **entity_names = va_arg(args, char**);
#  764|   			int entity_names_length = va_arg(args, int);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def111]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:762:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'key' where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:755:12: branch_false: following 'false' branch (when 'actions' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:758:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:760:16: branch_true: following 'true' branch (when 'arg' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:761:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:761:29: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:762:22: danger: argument 1 ('key') from [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#  760|   	while (arg) {
#  761|   		char *key = strdup(arg);
#  762|-> 		if (!strcmp(key, "SyncDeviceLinkEntityNamesKey")) {
#  763|   			char **entity_names = va_arg(args, char**);
#  764|   			int entity_names_length = va_arg(args, int);

Error: CPPCHECK_WARNING (CWE-476): [#def112]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:101: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   99|   
#  100|   	np_client_t client_loc = (np_client_t) malloc(sizeof(struct np_client_private));
#  101|-> 	client_loc->parent = plistclient;
#  102|   
#  103|   	mutex_init(&client_loc->mutex);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def113]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:101:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:96:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:96:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:100:48: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:100:48: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:101:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   99|   
#  100|   	np_client_t client_loc = (np_client_t) malloc(sizeof(struct np_client_private));
#  101|-> 	client_loc->parent = plistclient;
#  102|   
#  103|   	mutex_init(&client_loc->mutex);

Error: CPPCHECK_WARNING (CWE-476): [#def114]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:104: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  102|   
#  103|   	mutex_init(&client_loc->mutex);
#  104|-> 	client_loc->notifier = THREAD_T_NULL;
#  105|   
#  106|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def115]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:84: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   82|   
#   83|   	preboard_client_t client_loc = (preboard_client_t) malloc(sizeof(struct preboard_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   	client_loc->receive_status_thread = THREAD_T_NULL;
#   86|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def116]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:84:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:69:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:78:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:78:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:83:60: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:83:60: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:84:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   82|   
#   83|   	preboard_client_t client_loc = (preboard_client_t) malloc(sizeof(struct preboard_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   	client_loc->receive_status_thread = THREAD_T_NULL;
#   86|   

Error: CPPCHECK_WARNING (CWE-476): [#def117]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:85: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   83|   	preboard_client_t client_loc = (preboard_client_t) malloc(sizeof(struct preboard_client_private));
#   84|   	client_loc->parent = plclient;
#   85|-> 	client_loc->receive_status_thread = THREAD_T_NULL;
#   86|   
#   87|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def118]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:74: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   72|   	/* create client object */
#   73|   	property_list_service_client_t client_loc = (property_list_service_client_t)malloc(sizeof(struct property_list_service_client_private));
#   74|-> 	client_loc->parent = parent;
#   75|   
#   76|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def119]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:74:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:63:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:68:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:73:85: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:73:85: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:74:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   72|   	/* create client object */
#   73|   	property_list_service_client_t client_loc = (property_list_service_client_t)malloc(sizeof(struct property_list_service_client_private));
#   74|-> 	client_loc->parent = parent;
#   75|   
#   76|   	/* all done, return success */

Error: CPPCHECK_WARNING (CWE-476): [#def120]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:315: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  313|   
#  314|   	restored_client_t client_loc = (restored_client_t) malloc(sizeof(struct restored_client_private));
#  315|-> 	client_loc->parent = plistclient;
#  316|   	client_loc->udid = NULL;
#  317|   	client_loc->label = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def121]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:315:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:296:12: branch_false: following 'false' branch (when 'client' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:307:40: branch_false: ...to here
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:309:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:309:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:314:60: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:314:60: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:315:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  313|   
#  314|   	restored_client_t client_loc = (restored_client_t) malloc(sizeof(struct restored_client_private));
#  315|-> 	client_loc->parent = plistclient;
#  316|   	client_loc->udid = NULL;
#  317|   	client_loc->label = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def122]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:316: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  314|   	restored_client_t client_loc = (restored_client_t) malloc(sizeof(struct restored_client_private));
#  315|   	client_loc->parent = plistclient;
#  316|-> 	client_loc->udid = NULL;
#  317|   	client_loc->label = NULL;
#  318|   	client_loc->info = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def123]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:317: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  315|   	client_loc->parent = plistclient;
#  316|   	client_loc->udid = NULL;
#  317|-> 	client_loc->label = NULL;
#  318|   	client_loc->info = NULL;
#  319|   	if (label != NULL)

Error: CPPCHECK_WARNING (CWE-476): [#def124]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:318: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  316|   	client_loc->udid = NULL;
#  317|   	client_loc->label = NULL;
#  318|-> 	client_loc->info = NULL;
#  319|   	if (label != NULL)
#  320|   		client_loc->label = strdup(label);

Error: CPPCHECK_WARNING (CWE-476): [#def125]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:320: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  318|   	client_loc->info = NULL;
#  319|   	if (label != NULL)
#  320|-> 		client_loc->label = strdup(label);
#  321|   
#  322|   	idev_ret = idevice_get_udid(device, &client_loc->udid);

Error: GCC_ANALYZER_WARNING (CWE-457): [#def126]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:283:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'dict'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:345:14: enter_function: entry to '_reverse_proxy_connection_thread'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:352:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:359:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:362:23: call_function: calling 'reverse_proxy_client_new' from '_reverse_proxy_connection_thread'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:362:23: return_function: returning to '_reverse_proxy_connection_thread' from 'reverse_proxy_client_new'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:363:20: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:367:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:370:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:378:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:419:23: call_function: inlined call to 'reverse_proxy_receive' from '_reverse_proxy_connection_thread'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:419:23: call_function: inlined call to 'reverse_proxy_receive' from '_reverse_proxy_connection_thread'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:420:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:424:21: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:424:20: branch_false: following 'false' branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:430:9: call_function: calling '_reverse_proxy_status' from '_reverse_proxy_connection_thread'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:430:9: return_function: returning to '_reverse_proxy_connection_thread' from '_reverse_proxy_status'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:433:16: branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:436:23: call_function: calling 'reverse_proxy_receive_with_timeout' from '_reverse_proxy_connection_thread'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:436:23: return_function: returning to '_reverse_proxy_connection_thread' from 'reverse_proxy_receive_with_timeout'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:437:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:437:21: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:439:27: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:443:23: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:447:29: call_function: calling '_reverse_proxy_handle_plist_cmd' from '_reverse_proxy_connection_thread'
#  281|   		return -1;
#  282|   	}
#  283|-> 	plist_t node = plist_dict_get_item(dict, "Command");
#  284|   	if (!node || (plist_get_node_type(node) != PLIST_STRING)) {
#  285|   		_reverse_proxy_log(client, "ERROR: No 'Command' in reply", err);

Error: CPPCHECK_WARNING (CWE-476): [#def127]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:338: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  336|   
#  337|   	reverse_proxy_client_t client_loc = (reverse_proxy_client_t) calloc(1, sizeof(struct reverse_proxy_client_private));
#  338|-> 	client_loc->parent = sclient;
#  339|   	client_loc->th_ctrl = THREAD_T_NULL;
#  340|   	*client = client_loc;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def128]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:338:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:623:23: enter_function: entry to 'reverse_proxy_client_create_with_port'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:633:15: call_function: calling 'reverse_proxy_client_new' from 'reverse_proxy_client_create_with_port'
#  336|   
#  337|   	reverse_proxy_client_t client_loc = (reverse_proxy_client_t) calloc(1, sizeof(struct reverse_proxy_client_private));
#  338|-> 	client_loc->parent = sclient;
#  339|   	client_loc->th_ctrl = THREAD_T_NULL;
#  340|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def129]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:339: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#  337|   	reverse_proxy_client_t client_loc = (reverse_proxy_client_t) calloc(1, sizeof(struct reverse_proxy_client_private));
#  338|   	client_loc->parent = sclient;
#  339|-> 	client_loc->th_ctrl = THREAD_T_NULL;
#  340|   	*client = client_loc;
#  341|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def130]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:638:9: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:623:23: enter_function: entry to 'reverse_proxy_client_create_with_port'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:633:15: call_function: calling 'reverse_proxy_client_new' from 'reverse_proxy_client_create_with_port'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:633:15: return_function: returning to 'reverse_proxy_client_create_with_port' from 'reverse_proxy_client_new'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:634:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:638:19: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:638:19: release_memory: 'client_loc' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:639:9: release_memory: '*client' is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:638:9: danger: dereference of NULL 'client_loc'
#  636|   	}
#  637|   
#  638|-> 	client_loc->type = RP_TYPE_CTRL;
#  639|   	*client = client_loc;
#  640|   

Error: CPPCHECK_WARNING (CWE-476): [#def131]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:91: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   89|   
#   90|   	sbservices_client_t client_loc = (sbservices_client_t) malloc(sizeof(struct sbservices_client_private));
#   91|-> 	client_loc->parent = plistclient;
#   92|   	mutex_init(&client_loc->mutex);
#   93|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def132]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:91:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:86:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:86:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:90:64: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:90:64: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:91:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   89|   
#   90|   	sbservices_client_t client_loc = (sbservices_client_t) malloc(sizeof(struct sbservices_client_private));
#   91|-> 	client_loc->parent = plistclient;
#   92|   	mutex_init(&client_loc->mutex);
#   93|   

Error: CPPCHECK_WARNING (CWE-476): [#def133]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:81: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   79|   
#   80|   	screenshotr_client_t client_loc = (screenshotr_client_t) malloc(sizeof(struct screenshotr_client_private));
#   81|-> 	client_loc->parent = dlclient;
#   82|   
#   83|   	/* perform handshake */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def134]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:81:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:71:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:76:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:76:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:80:66: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:80:66: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:81:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   79|   
#   80|   	screenshotr_client_t client_loc = (screenshotr_client_t) malloc(sizeof(struct screenshotr_client_private));
#   81|-> 	client_loc->parent = dlclient;
#   82|   
#   83|   	/* perform handshake */

Error: CPPCHECK_WARNING (CWE-476): [#def135]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:72: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   70|   	/* create client object */
#   71|   	service_client_t client_loc = (service_client_t)malloc(sizeof(struct service_client_private));
#   72|-> 	client_loc->connection = connection;
#   73|   
#   74|   	/* enable SSL if requested */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def136]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:72:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:61:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:66:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:71:57: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:71:57: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:72:9: danger: 'client_loc' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   70|   	/* create client object */
#   71|   	service_client_t client_loc = (service_client_t)malloc(sizeof(struct service_client_private));
#   72|-> 	client_loc->connection = connection;
#   73|   
#   74|   	/* enable SSL if requested */

Error: CPPCHECK_WARNING (CWE-476): [#def137]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:89: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   87|   
#   88|   	syslog_relay_client_t client_loc = (syslog_relay_client_t) malloc(sizeof(struct syslog_relay_client_private));
#   89|-> 	client_loc->parent = parent;
#   90|   	client_loc->worker = THREAD_T_NULL;
#   91|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def138]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:89:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:74:12: branch_false: following 'false' branch...
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:83:12: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:83:12: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:88:68: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:88:68: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:89:9: danger: 'client_loc' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   87|   
#   88|   	syslog_relay_client_t client_loc = (syslog_relay_client_t) malloc(sizeof(struct syslog_relay_client_private));
#   89|-> 	client_loc->parent = parent;
#   90|   	client_loc->worker = THREAD_T_NULL;
#   91|   

Error: CPPCHECK_WARNING (CWE-476): [#def139]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:90: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   88|   	syslog_relay_client_t client_loc = (syslog_relay_client_t) malloc(sizeof(struct syslog_relay_client_private));
#   89|   	client_loc->parent = parent;
#   90|-> 	client_loc->worker = THREAD_T_NULL;
#   91|   
#   92|   	*client = client_loc;

Error: CPPCHECK_WARNING (CWE-476): [#def140]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:84: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: client_loc
#   82|   
#   83|   	webinspector_client_t client_loc = (webinspector_client_t) malloc(sizeof(struct webinspector_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   
#   86|   	*client = client_loc;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def141]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:195:32: warning[-Wanalyzer-malloc-leak]: leak of 'packet'
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:202:28: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:213:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:214:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:222:20: branch_true: following 'true' branch (when 'packet' is NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:244:17: branch_true: following 'true' branch (when 'is_final_message == 0')...
 branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:195:32: danger: 'packet' leaks here; was allocated at [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
#  193|   			debug_info("Could not receive message, error %d", res);
#  194|   			plist_free(message);
#  195|-> 			return WEBINSPECTOR_E_MUX_ERROR;
#  196|   		}
#  197|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def142]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: warning[-Wanalyzer-malloc-leak]: leak of 'packet'
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:202:28: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:213:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:214:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:222:20: branch_true: following 'true' branch (when 'packet' is NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:244:17: branch_true: following 'true' branch (when 'is_final_message == 0')...
 branch_true: ...to here
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:214:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:222:20: branch_false: following 'false' branch (when 'packet' is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:225:60: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:244:17: branch_true: following 'true' branch (when 'is_final_message == 0')...
 branch_true: ...to here
 branch_true: following 'true' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:192:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:214:20: branch_false: following 'false' branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:222:20: branch_true: following 'true' branch (when 'packet' is NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: danger: 'packet' leaks here; was allocated at [(11)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/10)
#  221|   		/* (re)allocate packet data */
#  222|   		if (!packet) {
#  223|-> 			packet = (char*)malloc(length * sizeof(char));
#  224|   		} else {
#  225|   			newpacket = (char*)realloc(packet, (packet_length + length) * sizeof(char));

Error: CPPCHECK_WARNING (CWE-682): [#def143]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:230: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
#  228|   
#  229|   		/* copy partial data into final packet data */
#  230|-> 		memcpy(packet + packet_length, buffer, length);
#  231|   
#  232|   		/* cleanup buffer */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def144]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1448:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1444:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1445:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1445:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1446:39: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1446:32: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1448:21: danger: argument 1 (‘udid’) from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 1446|   			udid = strdup(event->udid);
# 1447|   		}
# 1448|-> 		if (strcmp(udid, event->udid) == 0) {
# 1449|   			connected = 1;
# 1450|   		}

Error: CPPCHECK_WARNING (CWE-476): [#def145]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:238: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: filename
#  236|   {
#  237|   	char* filename = (char*)malloc(strlen(name)+(extension == NULL ? 0: strlen(extension))+1);
#  238|-> 	strcpy(filename, name);
#  239|   	if (extension != NULL)
#  240|   		strcat(filename, extension);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def146]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:238:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘filename’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:611:5: enter_function: entry to ‘main’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:681:12: branch_false: following ‘false’ branch (when ‘argc > 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:687:14: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:697:12: branch_false: following ‘false’ branch (when ‘argc != 1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:702:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:705:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:711:27: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:711:27: call_function: calling ‘mobilebackup_build_path’ from ‘main’
#argument 1 of ‘__builtin_strcpy’ must be non-null
#  236|   {
#  237|   	char* filename = (char*)malloc(strlen(name)+(extension == NULL ? 0: strlen(extension))+1);
#  238|-> 	strcpy(filename, name);
#  239|   	if (extension != NULL)
#  240|   		strcat(filename, extension);

Error: CPPCHECK_WARNING (CWE-476): [#def147]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:240: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: filename
#  238|   	strcpy(filename, name);
#  239|   	if (extension != NULL)
#  240|-> 		strcat(filename, extension);
#  241|   	char *path = string_build_path(backup_directory, filename, NULL);
#  242|   	free(filename);

Error: CPPCHECK_WARNING (CWE-476): [#def148]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:461: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fnstr
#  459|   
#  460|   	char *fnstr = malloc(strlen(domain) + 1 + strlen(destpath) + 1);
#  461|-> 	strcpy(fnstr, domain);
#  462|   	strcat(fnstr, "-");
#  463|   	strcat(fnstr, destpath);

Error: CPPCHECK_WARNING (CWE-476): [#def149]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:462: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fnstr
#  460|   	char *fnstr = malloc(strlen(domain) + 1 + strlen(destpath) + 1);
#  461|   	strcpy(fnstr, domain);
#  462|-> 	strcat(fnstr, "-");
#  463|   	strcat(fnstr, destpath);
#  464|   	unsigned char fnhash[20];

Error: CPPCHECK_WARNING (CWE-476): [#def150]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:463: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fnstr
#  461|   	strcpy(fnstr, domain);
#  462|   	strcat(fnstr, "-");
#  463|-> 	strcat(fnstr, destpath);
#  464|   	unsigned char fnhash[20];
#  465|   	char fnamehash[41];

Error: CPPCHECK_WARNING (CWE-457): [#def151]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:518: warning[uninitvar]: Uninitialized variable: file_hash
#  516|   		print_hash(data_hash, 20);
#  517|   		printf("\nfilehash: ");
#  518|-> 		print_hash(file_hash, 20);
#  519|   		printf("\n");
#  520|   		res = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def152]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:662:25: warning[-Wanalyzer-malloc-leak]: leak of ‘udid’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:651:16: branch_true: following ‘true’ branch (when ‘c != -1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:652:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:657:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:662:32: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:662:32: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:651:16: branch_true: following ‘true’ branch (when ‘c != -1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:652:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:657:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:662:32: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:662:25: danger: ‘udid’ leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  660|   				return 2;
#  661|   			}
#  662|-> 			udid = strdup(optarg);
#  663|   			break;
#  664|   		case 'n':

Error: CPPCHECK_WARNING (CWE-476): [#def153]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:342: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: uuid
#  340|   
#  341|   	for (i = 0; i < 32; i++) {
#  342|-> 		uuid[i] = chars[rand() % 16];
#  343|   	}
#  344|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def154]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:342:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘uuid’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:337:29: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:341:21: branch_true: following ‘true’ branch (when ‘i != 32’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:342:33: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:342:17: danger: ‘uuid + (sizetype)i’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  340|   
#  341|   	for (i = 0; i < 32; i++) {
#  342|-> 		uuid[i] = chars[rand() % 16];
#  343|   	}
#  344|   

Error: CPPCHECK_WARNING (CWE-476): [#def155]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:345: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: uuid
#  343|   	}
#  344|   
#  345|-> 	uuid[32] = '\0';
#  346|   
#  347|   	return uuid;

Error: CPPCHECK_WARNING (CWE-476): [#def156]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:525: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fname
#  523|   		data_size = 0;
#  524|   		char *fname = (char*)malloc(strlen("/iTunes_Control/iTunes/") + strlen(itunesfiles[i]) + 1);
#  525|-> 		strcpy(fname, "/iTunes_Control/iTunes/");
#  526|   		strcat(fname, itunesfiles[i]);
#  527|   		mobilebackup_afc_get_file_contents(afc, fname, &data_buf, &data_size);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def157]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:525:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fname’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:350:16: enter_function: entry to ‘mobilebackup_factory_info_plist_new’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:360:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:364:23: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:448:22: call_function: calling ‘get_uuid’ from ‘mobilebackup_factory_info_plist_new’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:448:22: return_function: returning to ‘mobilebackup_factory_info_plist_new’ from ‘get_uuid’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:500:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:505:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:521:21: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:522:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:524:38: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:525:17: danger: argument 1 (‘fname’) from [(17)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/16) could be NULL where non-null expected
#argument 1 of ‘__builtin_memcpy’ must be non-null
#  523|   		data_size = 0;
#  524|   		char *fname = (char*)malloc(strlen("/iTunes_Control/iTunes/") + strlen(itunesfiles[i]) + 1);
#  525|-> 		strcpy(fname, "/iTunes_Control/iTunes/");
#  526|   		strcat(fname, itunesfiles[i]);
#  527|   		mobilebackup_afc_get_file_contents(afc, fname, &data_buf, &data_size);

Error: CPPCHECK_WARNING (CWE-476): [#def158]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:526: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fname
#  524|   		char *fname = (char*)malloc(strlen("/iTunes_Control/iTunes/") + strlen(itunesfiles[i]) + 1);
#  525|   		strcpy(fname, "/iTunes_Control/iTunes/");
#  526|-> 		strcat(fname, itunesfiles[i]);
#  527|   		mobilebackup_afc_get_file_contents(afc, fname, &data_buf, &data_size);
#  528|   		free(fname);

Error: CPPCHECK_WARNING (CWE-476): [#def159]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1150: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: msg
# 1148|   			char *msg = (char*)malloc(nlen);
# 1149|   			mobilebackup2_receive_raw(mobilebackup2, msg, nlen-1, &r);
# 1150|-> 			msg[r] = 0;
# 1151|   			/* If sent using CODE_FILE_DATA, end marker will be CODE_ERROR_REMOTE which is not an error! */
# 1152|   			if (last_code != CODE_FILE_DATA) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def160]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1555:25: warning[-Wanalyzer-malloc-leak]: leak of ‘udid’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1544:16: branch_true: following ‘true’ branch (when ‘c != -1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1545:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1550:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1555:32: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1555:32: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1544:16: branch_true: following ‘true’ branch (when ‘c != -1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1545:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1550:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1555:32: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1555:25: danger: ‘udid’ leaks here; was allocated at [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6)
# 1553|   				return 2;
# 1554|   			}
# 1555|-> 			udid = strdup(optarg);
# 1556|   			break;
# 1557|   		case 's':

Error: CPPCHECK_WARNING (CWE-476): [#def161]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:266: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: udid
#  264|   				udid = strdup(event->udid);
#  265|   			}
#  266|-> 			if (strcmp(udid, event->udid) == 0) {
#  267|   				if (start_logging() != 0) {
#  268|   					fprintf(stderr, "Could not start logger for udid %s\n", udid);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def162]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:266:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:261:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:262:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:262:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:263:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:263:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:264:47: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:264:40: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:266:29: danger: argument 1 (‘udid’) from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
#  264|   				udid = strdup(event->udid);
#  265|   			}
#  266|-> 			if (strcmp(udid, event->udid) == 0) {
#  267|   				if (start_logging() != 0) {
#  268|   					fprintf(stderr, "Could not start logger for udid %s\n", udid);

Error: CPPCHECK_WARNING (CWE-476): [#def163]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:76: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: raw_filename
#   74|   
#   75|   	/* create filename with '.crash' extension */
#   76|-> 	char* p = strrchr(raw_filename, '.');
#   77|   	if ((p == NULL) || (strcmp(p, ".plist") != 0)) {
#   78|   		free(raw_filename);

Error: CPPCHECK_WARNING (CWE-476): [#def164]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:470: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ping
#  468|   	/* read "ping" message which indicates the crash logs have been moved to a safe harbor */
#  469|   	char *ping = malloc(4);
#  470|-> 	memset(ping, '\0', 4);
#  471|   	int attempts = 0;
#  472|   	while ((strncmp(ping, "ping", 4) != 0) && (attempts < 10)) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def165]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:470:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ping’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:417:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:422:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:425:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:430:24: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:431:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:440:27: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:441:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:448:40: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:450:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:458:26: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:462:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:469:22: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:469:22: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:470:9: danger: argument 1 (‘ping’) from [(13)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/12) could be NULL where non-null expected
#argument 1 of ‘__builtin_memset’ must be non-null
#  468|   	/* read "ping" message which indicates the crash logs have been moved to a safe harbor */
#  469|   	char *ping = malloc(4);
#  470|-> 	memset(ping, '\0', 4);
#  471|   	int attempts = 0;
#  472|   	while ((strncmp(ping, "ping", 4) != 0) && (attempts < 10)) {

Error: CPPCHECK_WARNING (CWE-476): [#def166]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:472: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ping
#  470|   	memset(ping, '\0', 4);
#  471|   	int attempts = 0;
#  472|-> 	while ((strncmp(ping, "ping", 4) != 0) && (attempts < 10)) {
#  473|   		uint32_t bytes = 0;
#  474|   		service_error = service_receive_with_timeout(svcmove, ping, 4, &bytes, 2000);

Error: CPPCHECK_WARNING (CWE-476): [#def167]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:281: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: newlist
#  279|   			else
#  280|   				newlist = realloc(environment, (environment_count + 1) * sizeof(char*));
#  281|-> 			newlist[environment_count++] = strdup(optarg);
#  282|   			environment = newlist;
#  283|   			break;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def168]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:281:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘newlist’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:247:16: branch_true: following ‘true’ branch (when ‘c != -1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:248:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:270:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:270:41: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:270:29: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:277:28: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:277:28: branch_true: following ‘true’ branch (when ‘newlist’ is NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:278:50: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:278:43: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:281:25: danger: ‘newlist + (long unsigned int)environment_count * 8’ could be NULL: unchecked value from [(12)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/11)
#  279|   			else
#  280|   				newlist = realloc(environment, (environment_count + 1) * sizeof(char*));
#  281|-> 			newlist[environment_count++] = strdup(optarg);
#  282|   			environment = newlist;
#  283|   			break;

Error: CPPCHECK_WARNING (CWE-476): [#def169]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:468: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: app_argv
#  466|   	int app_argc = (argc - i + 2);
#  467|   	char **app_argv = (char**)malloc(sizeof(char*) * app_argc);
#  468|-> 	app_argv[0] = path;
#  469|   	log_debug("app_argv[%d] = %s", 0, app_argv[0]);
#  470|   	app_argc = 1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def170]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:468:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘app_argv’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:204:5: enter_function: entry to ‘main’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:304:12: branch_false: following ‘false’ branch (when ‘argc > 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:310:14: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:312:20: branch_false: following ‘false’ branch (when ‘argc != 1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:320:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:344:12: branch_false: following ‘false’ branch (when ‘environment’ is NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:351:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:352:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:362:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:362:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:367:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:368:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:373:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:374:9: call_function: calling ‘instproxy_client_get_object_by_key_from_info_dictionary_for_bundle_identifier’ from ‘main’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:374:9: return_function: returning to ‘main’ from ‘instproxy_client_get_object_by_key_from_info_dictionary_for_bundle_identifier’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:378:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:389:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:400:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:400:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:406:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:445:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:455:12: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:455:12: branch_false: following ‘false’ branch (when ‘environment’ is NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:464:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:467:35: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:468:9: danger: ‘app_argv’ could be NULL: unchecked value from [(35)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/34)
#  466|   	int app_argc = (argc - i + 2);
#  467|   	char **app_argv = (char**)malloc(sizeof(char*) * app_argc);
#  468|-> 	app_argv[0] = path;
#  469|   	log_debug("app_argv[%d] = %s", 0, app_argv[0]);
#  470|   	app_argc = 1;

Error: CPPCHECK_WARNING (CWE-476): [#def171]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:473: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: app_argv
#  471|   	while (i < argc && argv && argv[i]) {
#  472|   		log_debug("app_argv[%d] = %s", app_argc, argv[i]);
#  473|-> 		app_argv[app_argc++] = argv[i];
#  474|   		i++;
#  475|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def172]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:476: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: app_argv
#  474|   		i++;
#  475|   	}
#  476|-> 	app_argv[app_argc] = NULL;
#  477|   	debugserver_client_set_argv(debugserver_client, app_argc, app_argv, NULL);
#  478|   	free(app_argv);

Error: CPPCHECK_WARNING (CWE-476): [#def173]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:226: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: udid
#  224|   			udid = strdup(event->udid);
#  225|   		}
#  226|-> 		if (strcmp(udid, event->udid) == 0) {
#  227|   			device_connected = 1;
#  228|   		}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def174]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:226:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:222:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:223:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:223:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:224:39: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:224:32: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:226:21: danger: argument 1 (‘udid’) from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#  224|   			udid = strdup(event->udid);
#  225|   		}
#  226|-> 		if (strcmp(udid, event->udid) == 0) {
#  227|   			device_connected = 1;
#  228|   		}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def175]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: warning[-Wanalyzer-null-argument]: use of NULL ‘image_path’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:184:15: release_memory: ‘image_sig_path’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:271:15: release_memory: ‘image_sig_path’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:273:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:319:20: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:319:20: branch_false: following ‘false’ branch (when ‘disk_image_upload_type != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: danger: argument 1 (‘image_path’) NULL where non-null expected
#  332|   			}
#  333|   		}
#  334|-> 		if (stat(image_path, &fst) != 0) {
#  335|   			fprintf(stderr, "ERROR: stat: %s: %s\n", image_path, strerror(errno));
#  336|   			goto leave;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def176]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘image_path’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:230:28: branch_false: following ‘false’ branch (when ‘argc > 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:235:38: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:235:38: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:236:28: branch_true: following ‘true’ branch (when ‘argc != 1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:237:50: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:273:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:280:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:13: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:319:20: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:319:20: branch_false: following ‘false’ branch (when ‘disk_image_upload_type != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: danger: argument 1 (‘image_path’) from [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
#  332|   			}
#  333|   		}
#  334|-> 		if (stat(image_path, &fst) != 0) {
#  335|   			fprintf(stderr, "ERROR: stat: %s: %s\n", image_path, strerror(errno));
#  336|   			goto leave;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def177]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:339:51: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘image_sig_path’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:230:28: branch_false: following ‘false’ branch (when ‘argc > 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:235:38: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:236:28: branch_true: following ‘true’ branch (when ‘argc != 1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:237:50: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:237:50: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:273:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:280:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:13: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:319:20: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:319:20: branch_false: following ‘false’ branch (when ‘disk_image_upload_type != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:338:30: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:339:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:339:51: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:339:51: danger: argument 1 (‘image_sig_path’) from [(9)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/8) could be NULL where non-null expected
#  337|   		}
#  338|   		image_size = fst.st_size;
#  339|-> 		if (product_version_major < 17 && stat(image_sig_path, &fst) != 0) {
#  340|   			fprintf(stderr, "ERROR: stat: %s: %s\n", image_sig_path, strerror(errno));
#  341|   			goto leave;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def178]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:28: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(image_sig_path, "rb")’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:279:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:300:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:345:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:351:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:375:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:375:29: acquire_resource: opened here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:376:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:29: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:28: danger: ‘fopen(image_sig_path, "rb")’ leaks here; was opened at [(23)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/22)
#  378|   				goto leave;
#  379|   			}
#  380|-> 			if (fstat(fileno(f), &fst) != 0) {
#  381|   				fprintf(stderr, "Error: fstat: %s\n", strerror(errno));
#  382|   				goto leave;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def179]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:28: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(image_sig_path, "rb")’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:279:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:300:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:345:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:351:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:375:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:375:29: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:376:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:29: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:28: danger: ‘fopen(image_sig_path, "rb")’ leaks here; was allocated at [(23)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/22)
#  378|   				goto leave;
#  379|   			}
#  380|-> 			if (fstat(fileno(f), &fst) != 0) {
#  381|   				fprintf(stderr, "Error: fstat: %s\n", strerror(errno));
#  382|   				goto leave;

Error: CPPCHECK_WARNING (CWE-476): [#def180]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:385: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: sig
#  383|   			}
#  384|   			sig = malloc(fst.st_size);
#  385|-> 			sig_length = fread(sig, 1, fst.st_size, f);
#  386|   			fclose(f);
#  387|   			if (sig_length == 0) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def181]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: warning[-Wanalyzer-null-argument]: use of NULL ‘image_path’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:184:15: release_memory: ‘image_sig_path’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:271:15: release_memory: ‘image_sig_path’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:273:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:345:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:351:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: danger: argument 1 (‘image_path’) NULL where non-null expected
#  396|   			}
#  397|   		} else {
#  398|-> 			if (stat(image_path, &fst) != 0) {
#  399|   				fprintf(stderr, "Error: stat: '%s': %s\n", image_path, strerror(errno));
#  400|   				goto leave;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def182]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘image_path’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:230:28: branch_false: following ‘false’ branch (when ‘argc > 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:235:38: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:235:38: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:236:28: branch_true: following ‘true’ branch (when ‘argc != 1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:237:50: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:273:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:280:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:13: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:345:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:351:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: danger: argument 1 (‘image_path’) from [(7)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
#  396|   			}
#  397|   		} else {
#  398|-> 			if (stat(image_path, &fst) != 0) {
#  399|   				fprintf(stderr, "Error: stat: '%s': %s\n", image_path, strerror(errno));
#  400|   				goto leave;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def183]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(string_build_path(image_path,  plist_get_string_ptr(plist_access_path(build_identity, 4, "Manifest", "PersonalizedDMG", "Info", "Path"), 0), 0), "rb")’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:230:28: branch_false: following ‘false’ branch (when ‘argc > 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:235:38: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:236:28: branch_false: following ‘false’ branch (when ‘argc == 1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:239:37: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:239:36: branch_false: following ‘false’ branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:273:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:280:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:13: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:300:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:345:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:351:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:402:30: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:402:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:406:53: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:417:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:422:33: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:424:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:429:49: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:439:36: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:442:74: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:450:28: branch_false: following ‘false’ branch (when ‘build_identity’ is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:454:45: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:455:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:459:46: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:460:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:464:41: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:467:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:471:41: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:477:29: acquire_resource: opened here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:478:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:486:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:489:32: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:496:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:501:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: danger: ‘fopen(string_build_path(image_path,  plist_get_string_ptr(plist_access_path(build_identity, 4, "Manifest", "PersonalizedDMG", "Info", "Path"), 0), 0), "rb")’ leaks here; was opened at [(55)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/54)
#  503|   			} else {
#  504|   				/* we need to re-connect in this case */
#  505|-> 				mobile_image_mounter_free(mim);
#  506|   				mim = NULL;
#  507|   				if (mobile_image_mounter_start_service(device, &mim, TOOL_NAME) != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def184]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(string_build_path(image_path,  plist_get_string_ptr(plist_access_path(build_identity, 4, "Manifest", "PersonalizedDMG", "Info", "Path"), 0), 0), "rb")’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:194:12: branch_false: following ‘false’ branch (when ‘argc != 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:200:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:230:28: branch_false: following ‘false’ branch (when ‘argc > 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:235:38: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:236:28: branch_false: following ‘false’ branch (when ‘argc == 1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:239:37: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:239:36: branch_false: following ‘false’ branch...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:256:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:44: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:265:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:270:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:273:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:280:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:281:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:13: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:286:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:300:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:302:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:307:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:312:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:13: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:317:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:345:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:351:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:367:19: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:374:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:402:30: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:402:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:406:53: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:417:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:422:33: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:424:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:429:49: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:439:36: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:442:74: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:450:28: branch_false: following ‘false’ branch (when ‘build_identity’ is non-NULL)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:454:45: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:455:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:459:46: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:460:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:464:41: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:467:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:471:41: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:477:29: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:478:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:486:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:489:32: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:496:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:501:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: danger: ‘fopen(string_build_path(image_path,  plist_get_string_ptr(plist_access_path(build_identity, 4, "Manifest", "PersonalizedDMG", "Info", "Path"), 0), 0), "rb")’ leaks here; was allocated at [(55)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/54)
#  503|   			} else {
#  504|   				/* we need to re-connect in this case */
#  505|-> 				mobile_image_mounter_free(mim);
#  506|   				mim = NULL;
#  507|   				if (mobile_image_mounter_start_service(device, &mim, TOOL_NAME) != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def185]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:186:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:160:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:166:14: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:174:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:181:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:184:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:186:41: release_memory: ‘nspectmp’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:186:33: danger: dereference of NULL ‘nspectmp + (long unsigned int)count * 8’
#  184|   			if (argv[i] && (strlen(argv[i]) >= 2) && (strncmp(argv[i], "-", 1) != 0)) {
#  185|   				nspectmp = realloc(nspec, sizeof(char*) * (count+1));
#  186|-> 				nspectmp[count] = strdup(argv[i]);
#  187|   				nspec = nspectmp;
#  188|   				count = count+1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def186]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:189:33: warning[-Wanalyzer-malloc-leak]: leak of ‘nspec’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:160:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:166:14: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:174:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:181:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:184:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:184:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:189:33: danger: ‘nspec’ leaks here; was allocated at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
#  187|   				nspec = nspectmp;
#  188|   				count = count+1;
#  189|-> 				i++;
#  190|   			} else {
#  191|   				i--;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def187]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:197:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:160:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:166:14: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:174:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:181:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:197:25: release_memory: ‘nspectmp’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:197:17: danger: dereference of NULL ‘nspectmp + (long unsigned int)count * 8’
#  195|   
#  196|   		nspectmp = realloc(nspec, sizeof(char*) * (count+1));
#  197|-> 		nspectmp[count] = NULL;
#  198|   		nspec = nspectmp;
#  199|   	}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def188]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:236:47: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:160:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:166:14: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:174:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:181:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:184:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:184:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:208:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:217:42: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:217:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:222:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:226:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:227:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:231:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:233:25: branch_true: following ‘true’ branch (when ‘cmd == 2’)...
 branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:236:52: release_memory: ‘nspectmp’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:236:47: danger: dereference of NULL ‘nspectmp + (long unsigned int)i * 8’
#  234|   				case CMD_POST:
#  235|   					i = 0;
#  236|-> 					while(nspec[i] != NULL && i < (count+1)) {
#  237|   						printf("< posting \"%s\"\n", nspec[i]);
#  238|   						np_post_notification(gnp, nspec[i]);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def189]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:245:47: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:160:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:166:14: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:174:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:181:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:184:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:184:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:208:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:217:42: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:217:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:222:15: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:226:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:227:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:231:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:233:25: branch_false: following ‘false’ branch (when ‘cmd != 2’)...
 branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:245:52: release_memory: ‘nspectmp’ is NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:245:47: danger: dereference of NULL ‘nspectmp + (long unsigned int)i * 8’
#  243|   				default:
#  244|   					i = 0;
#  245|-> 					while(nspec[i] != NULL && i < (count+1)) {
#  246|   						printf("! observing \"%s\"\n", nspec[i]);
#  247|   						np_observe_notification(gnp, nspec[i]);

Error: CPPCHECK_WARNING (CWE-476): [#def190]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:69: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: basename
#   67|   	if (*filename) {
#   68|   		basename = (char*)malloc(strlen(*filename) + 1);
#   69|-> 		strcpy(basename, *filename);
#   70|   		free(*filename);
#   71|   		*filename = NULL;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def191]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:69:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘basename’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:67:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:68:42: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:68:35: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:69:17: danger: argument 1 (‘basename’) from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#argument 1 of ‘__builtin_strcpy’ must be non-null
#   67|   	if (*filename) {
#   68|   		basename = (char*)malloc(strlen(*filename) + 1);
#   69|-> 		strcpy(basename, *filename);
#   70|   		free(*filename);
#   71|   		*filename = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def192]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:75: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: basename
#   73|   		time_t now = time(NULL);
#   74|   		basename = (char*)malloc(32);
#   75|-> 		strftime(basename, 31, "screenshot-%Y-%m-%d-%H-%M-%S", gmtime(&now));
#   76|   	}
#   77|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def193]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:75:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘basename’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:67:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:73:30: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:74:35: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:75:17: danger: argument 1 (‘basename’) from [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#   73|   		time_t now = time(NULL);
#   74|   		basename = (char*)malloc(32);
#   75|-> 		strftime(basename, 31, "screenshot-%Y-%m-%d-%H-%M-%S", gmtime(&now));
#   76|   	}
#   77|   

Error: CPPCHECK_WARNING (CWE-476): [#def194]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:79: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: basename
#   77|   
#   78|   	// Ensure the filename is unique on disk.
#   79|-> 	char *unique_filename = (char*)malloc(strlen(basename) + strlen(fileext) + 7);
#   80|   	sprintf(unique_filename, "%s%s", basename, fileext);
#   81|   	int i;

Error: CPPCHECK_WARNING (CWE-476): [#def195]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:80: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: basename
#   78|   	// Ensure the filename is unique on disk.
#   79|   	char *unique_filename = (char*)malloc(strlen(basename) + strlen(fileext) + 7);
#   80|-> 	sprintf(unique_filename, "%s%s", basename, fileext);
#   81|   	int i;
#   82|   	for (i = 2; i < (1 << 16); i++) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def196]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:80:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘unique_filename’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:67:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:73:30: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:79:40: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:80:9: danger: argument 1 (‘unique_filename’) from [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#argument 1 of ‘__builtin_sprintf’ must be non-null
#   78|   	// Ensure the filename is unique on disk.
#   79|   	char *unique_filename = (char*)malloc(strlen(basename) + strlen(fileext) + 7);
#   80|-> 	sprintf(unique_filename, "%s%s", basename, fileext);
#   81|   	int i;
#   82|   	for (i = 2; i < (1 << 16); i++) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def197]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:92:9: warning[-Wanalyzer-malloc-leak]: leak of ‘unique_filename’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:79:40: acquire_memory: allocated here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:82:21: branch_true: following ‘true’ branch (when ‘i != 65536’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:83:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:83:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:87:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:82:21: branch_true: following ‘true’ branch (when ‘i != 65536’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:83:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:83:20: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:87:17: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:89:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:92:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:92:9: danger: ‘unique_filename’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#   90|   		free(unique_filename);
#   91|   	}
#   92|-> 	free(basename);
#   93|   }
#   94|   

Error: CPPCHECK_WARNING (CWE-476): [#def198]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:178: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  176|   		latlen = strlen(argv[0]);
#  177|   		l = htobe32(latlen);
#  178|-> 		memcpy(buf, &l, 4);
#  179|   		memcpy(buf+4, argv[0], latlen);
#  180|   		uint32_t longlen = strlen(argv[1]);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def199]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:178:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘buf’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:114:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:119:12: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:132:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:142:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:146:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:152:9: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:160:12: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:168:18: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:172:12: branch_true: following ‘true’ branch (when ‘mode == 0’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:173:31: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:174:29: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:178:17: danger: ‘buf’ could be NULL: unchecked value from [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
#  176|   		latlen = strlen(argv[0]);
#  177|   		l = htobe32(latlen);
#  178|-> 		memcpy(buf, &l, 4);
#  179|   		memcpy(buf+4, argv[0], latlen);
#  180|   		uint32_t longlen = strlen(argv[1]);

Error: CPPCHECK_WARNING (CWE-682): [#def200]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:179: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
#  177|   		l = htobe32(latlen);
#  178|   		memcpy(buf, &l, 4);
#  179|-> 		memcpy(buf+4, argv[0], latlen);
#  180|   		uint32_t longlen = strlen(argv[1]);
#  181|   		l = htobe32(longlen);

Error: CPPCHECK_WARNING (CWE-682): [#def201]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:182: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
#  180|   		uint32_t longlen = strlen(argv[1]);
#  181|   		l = htobe32(longlen);
#  182|-> 		memcpy(buf+4+latlen, &l, 4);
#  183|   		memcpy(buf+4+latlen+4, argv[1], longlen);
#  184|   

Error: CPPCHECK_WARNING (CWE-682): [#def202]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:183: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
#  181|   		l = htobe32(longlen);
#  182|   		memcpy(buf+4+latlen, &l, 4);
#  183|-> 		memcpy(buf+4+latlen+4, argv[1], longlen);
#  184|   
#  185|   		s = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def203]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:87:47: warning[-Wanalyzer-malloc-leak]: leak of ‘procn’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:508:5: enter_function: entry to ‘main’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:545:16: branch_true: following ‘true’ branch (when ‘c != -1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:546:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:573:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:578:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:578:25: call_function: calling ‘add_filter’ from ‘main’
#   85|   		if ((*p == '|') || (*p == '\0')) {
#   86|   			if (p-start > 0) {
#   87|-> 				char* procn = malloc(p-start+1);
#   88|   				if (!procn) {
#   89|   					fprintf(stderr, "ERROR: malloc() failed\n");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def204]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:120:1: warning[-Wanalyzer-malloc-leak]: leak of ‘procn’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:508:5: enter_function: entry to ‘main’
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:545:16: branch_true: following ‘true’ branch (when ‘c != -1’)...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:546:17: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:573:28: branch_false: following ‘false’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:578:25: branch_false: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:578:25: call_function: calling ‘add_filter’ from ‘main’
#  118|   		p++;
#  119|   	}
#  120|-> }
#  121|   
#  122|   static int find_char(char c, char** p, const char* end)

Error: CPPCHECK_WARNING (CWE-476): [#def205]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:442: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: udid
#  440|   				udid = strdup(event->udid);
#  441|   			}
#  442|-> 			if (strcmp(udid, event->udid) == 0) {
#  443|   				if (start_logging() != 0) {
#  444|   					fprintf(stderr, "Could not start logger for udid %s\n", udid);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def206]
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:442:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:437:12: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:438:21: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:438:20: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:439:29: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:439:28: branch_true: following ‘true’ branch...
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:440:47: branch_true: ...to here
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:440:40: acquire_memory: this call could return NULL
libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:442:29: danger: argument 1 (‘udid’) from [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
#  440|   				udid = strdup(event->udid);
#  441|   			}
#  442|-> 			if (strcmp(udid, event->udid) == 0) {
#  443|   				if (start_logging() != 0) {
#  444|   					fprintf(stderr, "Could not start logger for udid %s\n", udid);

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-180.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namelibimobiledevice-1.3.0^20240916gited9703d-5.fc43
store-results-to/tmp/tmpiktsfb75/libimobiledevice-1.3.0^20240916gited9703d-5.fc43.tar.xz
time-created2025-04-25 14:00:18
time-finished2025-04-25 14:01:46
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpiktsfb75/libimobiledevice-1.3.0^20240916gited9703d-5.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpiktsfb75/libimobiledevice-1.3.0^20240916gited9703d-5.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9